using System;

using StructureMap.AutoMocking;

using StructureMap.TypeMockAutoMocker;

namespace StructureMap.TypeMockAutoMocker
{
	public class TypeMockAaaServiceLocator: ServiceLocator
	{
		private readonly TypeMockFactory _typeMockFactory;

		public TypeMockAaaServiceLocator()
		{
			_typeMockFactory = new TypeMockFactory();
		}

		public T PartialMock<T>(params object[] args) where T: class
		{
			return (T)_typeMockFactory.CreateFakeInstanceThatCallsToOriginalImplememtation(typeof(T), args);
		}

		public T Service<T>() where T: class
		{
			return (T)Service(typeof(T));
		}

		public object Service(Type serviceType)
		{
			return _typeMockFactory.CreateFakeInstanceThatReturnsDefaultValues(serviceType);
		}
	}
}